In recent years, great effort has been made to develop solid-state drives (SSDs) using, as a data storage device, a NAND flash memory (hereinafter sometimes simply referred to as a flash memory) that is a rewritable nonvolatile (or non-transitory) memory. In the SSD, as data in the flash memory is repeatedly rewritten, the ratio of storage areas in each block in which valid data (latest data) cannot be stored increases due to the presence of invalid data (data that is not latest). Thus, the SSD executes compaction processing of releasing blocks with reduced valid data to provide unwritten blocks. Garbage collection processing is different from the compaction processing in spite of the same purpose to release or clear up memory areas. The compaction processing is carried out in units of blocks.
Such compaction processing involves a method in which if for example, an error occurs in read processing for checking a block for valid data, the block is determined to be a bad block. However, such a method increases the number of unavailable blocks, possibly preventing the effective use of storage areas.